﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Warehouse.Api.Read.AllCation.Command;
using Warehouse.Api.Read.Dtos;
using Warehouse.Domian.Model;
using Warehouse.ErrorCode;

namespace Warehouse.Api.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class StockingController : ControllerBase
    {
        public readonly IMediator mediator;
        private readonly ILogger<StockingController> logger;

        public StockingController(IMediator mediator,ILogger<StockingController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }
        /// <summary>
        /// 获取获取出入库信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<StockingDtos>> GetStocking([FromQuery] GetStockingCommand request)
        {
            logger.LogInformation("GetInventory");
            return mediator.Send(request);
        }
        /// <summary>
        /// 出库信息的显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<ProductDto>> GetProduct([FromQuery]GetProductCommand request)
        {
            return await mediator.Send(request);
        }
        //[HttpGet]
        //[Authorize]
        //public async Task<ApiPaging<Shifting>> GetShifing([FromQuery]GetShifingCommand request)
        //{
        //    return await mediator.Send(request);
        //}
        /// <summary>
        /// 获取盘点信息列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        //[HttpGet]
        //[Authorize]
        //public async Task<ApiPaging<Checksheet>> GetChecksheet([FromQuery]GetChecksheetCommand request)
        //{
        //    return await mediator.Send(request);
        //}
        /// <summary>
        /// 获取破损信息列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        //[HttpGet]
        //[Authorize]
        //public async Task<ApiPaging<Breakage>> GwtBreakage([FromQuery]GetBreakageCommand request)
        //[HttpGet]
        //[Authorize]
        //public async Task<ApiPaging<Shifting>> GetShifing([FromQuery]GetShifingCommand request)
        //{
        //    return await mediator.Send(request);
        ////}
        ///// <summary>
        ///// 获取盘点信息列表
        ///// </summary>
        ///// <param name="request"></param>
        ///// <param name="cancellationToken"></param>
        ///// <returns></returns>
        //[HttpGet]
        //[Authorize]
        ////public async Task<ApiPaging<Checksheet>> GetChecksheet([FromQuery]GetChecksheetCommand request)
        ////{
        ////    return await mediator.Send(request);
        ////}
        ///// <summary>
        ///// 获取破损信息列表
        ///// </summary>
        ///// <param name="request"></param>
        ///// <param name="cancellationToken"></param>
        ///// <returns></returns>
        //[HttpGet]
        //[Authorize]
        ////public async Task<ApiPaging<Breakage>> GwtBreakage([FromQuery]GetBreakageCommand request)

        //{
        //    return await mediator.Send(request);
        //}
        ////{
        ////    return await mediator.Send(request);
        ////}
    }
}
